﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCodeFirst
{
    class Program
    {
        static void Main(string[] args)
        {
            using (Model1 context = new Model1())
            {
                context.Database.Log += s => Console.WriteLine($"【log:】{s}");

                REAL_RX_1_201810 rx = context.REAL_RX_1_201810.Where(c => c.RX_ID == 1810019495).FirstOrDefault();
                IQueryable<REAL_RX_1_201810> query = from p in context.REAL_RX_1_201810
                                                     where p.RX_ID == 1810019495
                                                     select p;
                query.ToList().ForEach(e => Console.WriteLine(e.ABX_FLAG));

                context.Entry<REAL_RX_1_201810>(rx).State = EntityState.Added;
                context.REAL_RX_1_201810.Attach(rx);

            }
            Console.ReadKey();

        }
    }
}
